<?php
class ERegistry extends EObject{
	var $registry;
	function __construct(){
		parent::__construct();
	}
	/**
	 * 分配一个值到当前对象
	 */
	function assign($name, $value = null) {
		if (is_array($name)) {
			foreach ($name as $k => $v) {
				$this->registry[$k] = $v;
			}
		} else {
			$this->registry[$name] = $value;
		}
	}
	/**
	 * 分配一个变量的引用到当前对象
	 * 注，引用必须为变量，不能引用一个常数
	 */
	function assignRef($name, & $value) {
		if (is_array($name)) {
			foreach ($name as $k => $val)
				$this->registry[$k] = $val;
		} else {
			$this->registry[$name] = & $value;
		}
	}
	/**
	 * 为变量追加值
	 */
	function append($name, $value=null) {
		if(is_string($name)){
			if (is_array($this->registry[$name])) {
				$this->registry[$name]=array_merge($this->registry[$name],(array)$value);
			}elseif(is_string($this->registry[$name])){
				$this->registry[$name] .= (string)$value;
			}
		}
	}
	/**
	 * 为变量追加引用
	 */
	function appendRef($name, &$value){
		;
	}
	function &get(){
		return $this->registry;
	}
}
?>
